
/****** Object:  StoredProcedure [usp_GetReff_CallTypeByID]    Script Date: 3/17/2013 8:51:01 PM ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[usp_GetReff_CallTypeByID]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
    DROP PROCEDURE [usp_GetReff_CallTypeByID];
GO

CREATE PROCEDURE [usp_GetReff_CallTypeByID]
(
	@CallTypeID int
)
AS
BEGIN
	SET NOCOUNT ON
	DECLARE @Err int

	SELECT
		[CallTypeID],
		[CallTypeName],
		[Description]
	FROM [Reff_CallType]
	WHERE
		([CallTypeID] = @CallTypeID)

	SET @Err = @@Error

	RETURN @Err
END
GO


/****** Object:  StoredProcedure [usp_GetAllReff_CallType]    Script Date: 3/17/2013 8:51:01 PM ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[usp_GetAllReff_CallType]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
    DROP PROCEDURE [usp_GetAllReff_CallType];
GO

CREATE PROCEDURE [usp_GetAllReff_CallType]
AS
BEGIN

	SET NOCOUNT ON
	DECLARE @Err int

	SELECT
		[CallTypeID],
		[CallTypeName],
		[Description]
	FROM [Reff_CallType]

	SET @Err = @@Error

	RETURN @Err
END
GO


/****** Object:  StoredProcedure [usp_UpdateReff_CallType]    Script Date: 3/17/2013 8:51:01 PM ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[usp_UpdateReff_CallType]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
    DROP PROCEDURE [usp_UpdateReff_CallType];
GO

CREATE PROCEDURE [usp_UpdateReff_CallType]
(
	@CallTypeID int,
	@CallTypeName varchar(50) = NULL,
	@Description varchar(MAX) = NULL
)
AS
BEGIN

	SET NOCOUNT OFF
	DECLARE @Err int

	UPDATE [Reff_CallType]
	SET
		[CallTypeName] = @CallTypeName,
		[Description] = @Description
	WHERE
		[CallTypeID] = @CallTypeID


	SET @Err = @@Error


	RETURN @Err
END
GO




/****** Object:  StoredProcedure [usp_InsertReff_CallType]    Script Date: 3/17/2013 8:51:01 PM ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[usp_InsertReff_CallType]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
    DROP PROCEDURE [usp_InsertReff_CallType];
GO

CREATE PROCEDURE [usp_InsertReff_CallType]
(
	@CallTypeID int = NULL output,
	@CallTypeName varchar(50) = NULL,
	@Description varchar(MAX) = NULL
)
AS
BEGIN

	SET NOCOUNT OFF
	DECLARE @Err int

	INSERT
	INTO [Reff_CallType]
	(
		[CallTypeName],
		[Description]
	)
	VALUES
	(
		@CallTypeName,
		@Description
	)

	SET @Err = @@Error

	SELECT @CallTypeID = SCOPE_IDENTITY()

	RETURN @Err
END
GO


/****** Object:  StoredProcedure [usp_DeleteReff_CallType]    Script Date: 3/17/2013 8:51:01 PM ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[usp_DeleteReff_CallType]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
    DROP PROCEDURE [usp_DeleteReff_CallType];
GO

CREATE PROCEDURE [usp_DeleteReff_CallType]
(
	@CallTypeID int
)
AS
BEGIN

	SET NOCOUNT OFF
	DECLARE @Err int

	DELETE
	FROM [Reff_CallType]
	WHERE
		[CallTypeID] = @CallTypeID
	SET @Err = @@Error

	RETURN @Err
END
GO

